﻿@model IEnumerable<HomeGuardBand.Models.Instrument>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

<table id="tblRegisteredInstrumentsList">
    <thead>
        <tr>
            <th>Column 1</th>
            <th>Column 2</th>
            <th>etc</th>
        </tr>
    </thead>
    <tbody id="table-data">

        @foreach (var instrument in Model)
        {
            <tr>
                <td>@Html.DisplayFor(modelItem => instrument.Active)</td>

                <td>@Html.DisplayFor(modelItem => instrument.Name)</td>

                <td>@Html.ActionLink("Edit", "Edit", new { id = instrument.Id }, new { @class = "btn" }) |
                    @Html.ActionLink("Details", "Details", new { id = instrument.Id }) |
                    @Html.ActionLink("Delete", "Delete", new { id = instrument.Id })</td>
            </tr>    
        }

    </tbody>

    @*Declaration of the table foot is needed here in order for the data tables fnFooterCallback to work*@
    <tfoot><tr></tr></tfoot>
</table>

<script type="text/javascript" src="~/Scripts/DataTables-1.9.4/media/js/jquery.dataTables.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#tblRegisteredInstrumentsList').dataTable();
    });
</script>